interface PaymentStrategy{
  pay(amount: number): void;
}

class Order{
  amount: number;
  paymentType: PaymentStrategy;

  constructor(amount: number, paymentType: PaymentStrategy){
    this.amount = amount;
    this.paymentType = paymentType;
  }

  py() {
    this.paymentType.pay(this.amount)
  }
}


class AliPay implements PaymentStrategy{
  pay(amount: number): void {
      console.log(`AliPay: ${amount}`)
  }
}

class WeChatPay implements PaymentStrategy{
  pay(amount: number): void {
      console.log(`WeChatPay: ${amount}`)
  }
}

let a = new Order(100, new AliPay())
let b = new Order(100, new WeChatPay())

a.py()
b.py()
